#include"share.hpp"


int main()
{

    int fd = open("myfifo",O_WRONLY);
    if(fd == -1)
    {
        log(error,"open failure: %s",strerror(errno));
        exit(5);
    }

    //获取shamid
    int shmid = Getshmid();
    char* shmaddr = (char*)shmat(shmid,nullptr,0);
    if((void*)shmaddr == (void*)-1)
    {
        log(fatal,"shamt failure: %s",strerror(errno));
        return 1;
    }

    while(true)
    {
        std::cout << "Please Enter@ ";
        fgets(shmaddr,SIZE_MM,stdin);

        int n = write(fd,"x",sizeof(char));
    }

    shmdt((void*)shmaddr);

    return 0;
}